package Bigu;

import java.util.ArrayList;

public class TasKMain {
    public static void main(String[] args) {
        ArrayList<String> list2 = new ArrayList<>();
        list2.add("彩云,20210322062");
        list2.add("凌云,20210322054");
        list2.add("埃是法国是,20210322013");
        list2.add("曲筱绡,20210322095");
        list2.add("徐福,20210322068");
        Runnable printwh = new PrintCharn(50);
        Runnable printt1 = new Printut(list2);
        Runnable printR1 = new PrintRun(50);
        // 创建线程
        Thread thread1 = new Thread(printwh);   // 创建一个线程 (实例化线程，并绑定任务)
        Thread thread2 = new Thread(printt1);   // 创建一个线程 (实例化线程，并绑定任务)
        Thread thread3 = new Thread(printR1);  // 创建一个线程 (实例化线程，并绑定任务)
        // 启动线程
        thread1.start();
        thread2.start();
        thread3.start();
    }

}
class PrintCharn implements Runnable{    // 任务1
    private int len;
    public PrintCharn(int t) {    //  任务类的构造方法
        len = t;
    }
    @Override
    public void run() {
        for (int i = 0; i < len; i++) {
            System.out.println("您好！");
        }
    }
}

class Printut implements Runnable{  // 任务2

    private java.util.ArrayList<String> ArrayList;
    private int len;
    public Printut(ArrayList<String> list2) {    //  任务类的构造方法
        ArrayList = list2;
    }
    @Override
    public void run() {
        for (int i = 0; i < ArrayList.size(); i++) {
            System.out.println(ArrayList.get(i));
        }
    }
}

class PrintRun implements Runnable{
    private int len;
    public PrintRun(int ln){
        len=ln;
    }
    @Override
    public void run() {
        for (int i = 0; i < len; i++) {
            System.out.println("再见");
        }
    }
}